Programming Questions for Practice
Write a program to find the simple and compound interest.
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
/*
Write a program to find the simple and compound interest.
*/
int main()
{
float principleAmount, rateOfInterest, duration;
float simpleInterest, compoundInterest;
/* Read the data */
printf("Enter the Principle Amount: ");
scanf("%f", &principleAmount);
printf("Enter the Rate of Interest: ");
scanf("%f", &rateOfInterest);
printf("Enter the duration in years: ");
scanf("%f", &duration);
/* Calculate simple interest and print */
simpleInterest = (principleAmount*rateOfInterest*duration) / 100;
printf("\nSimple Interest = %f\n", simpleInterest);
/* Calculate compound interest and print */
compoundInterest = principleAmount * pow(1+rateOfInterest / 100, duration);
printf("\nCompound Interest = %f\n", compoundInterest);
return 0;
}
Code not available...
Code not available...